﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace DecisionTree
{
    /// <summary>
    ///   Decision attribute.
    /// </summary>
    /// 
    [Serializable]
    public class DecisionVariable
    {
        public int Index { get; set; }

        /// <summary>
        ///   Gets the valid range of the attribute.
        /// </summary>
        /// 
        public Range Range { get; private set; }

        /// <summary>
        ///   Creates a new <see cref="DecisionVariable"/>.
        /// </summary>
        /// 
        /// <param name="name">The name of the attribute.</param>
        /// <param name="range">The range of valid values for this attribute. Default is [0;1].</param>
        /// 
        public DecisionVariable(int index, Range range)
        {
            this.Range = range;
            this.Index = index;
        }
    }

    /// <summary>
    ///   Collection of decision attributes.
    /// </summary>
    /// 
    [Serializable]
    public class DecisionAttributeCollection : ReadOnlyCollection<DecisionVariable>
    {
        /// <summary>
        ///   Initializes a new instance of the <see cref="DecisionAttributeCollection"/> class.
        /// </summary>
        /// 
        /// <param name="list">The list to initialize the collection.</param>
        /// 
        public DecisionAttributeCollection(IList<DecisionVariable> list)
            : base(list) { }
    }
}
